﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using iwss.Common;
using System.Collections;

namespace iwss.Document.ControlTemplates.iwss.Document
{
    public partial class SysUserTree : UserControl
    {
        //定义检查用户的委托和事件
        public delegate bool UserFromTargetDelegate(string Name);
        public event UserFromTargetDelegate ExistUser;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void init()
        {
            SPUserCollection users = SPContext.Current.Web.SiteUsers;
            foreach (SPUser user in users)
            {
                if (ExistUser != null && !ExistUser(user.Name))
                {
                    trUser.Nodes.Add(new TreeNode(user.Name, user.ID.ToString()));
                }
            }
        }
    }
}
